package com.bw.order.controller;

import com.bw.area.client.TbDictionaryClient;
import com.bw.order.service.TbHouseOrderService;
import com.bw.result.ResultVo;
import com.bw.vo.IdVo;
import com.bw.vo.TbDictionaryVo;
import com.bw.vo.TbHouseOrderSearchVo;
import com.bw.vo.TbHouseOrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @program: search-house
 * @ClassName TbHouseOrderController
 * @description:
 * @author:
 * @create: 2023-11-11 16:28
 * @Version 1.0
 **/
@RestController
@RequestMapping("order")
@Api(tags = "订单管理")
@Slf4j
public class TbHouseOrderController {

    @Autowired
    private TbHouseOrderService tbHouseOrderService;


    @Autowired
    TbDictionaryClient tbDictionaryClient;


    /** @Author 李博帅
     * @Description //TODO  openfegin调用 service-dictionary-manager listType()方法
     * @Date 9:34 2023/11/13
     * @param tbDictionaryVo
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/getOrderTypeList")
    @ApiOperation("获取订单类型")
    public ResultVo getOrderTypeList(@RequestBody TbDictionaryVo tbDictionaryVo){
        return tbDictionaryClient.listType(tbDictionaryVo);
    }

    /** @Author 李博帅
     * @Description //TODO 根据主键id删除订单 逻辑删除
     * @Date 16:34 2023/11/11
     * @param
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/del")
    @ApiOperation("删除订单")
    public ResultVo del(@RequestBody IdVo idVo){
        return tbHouseOrderService.del(idVo);
    }



    /** @Author 李博帅
     * @Description //TODO 添加订单
     * @Date 16:45 2023/11/11
     * @param tbHouseOrderVo
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/add")
    @ApiOperation("添加订单")
    public ResultVo add(@RequestBody TbHouseOrderVo tbHouseOrderVo){
        return tbHouseOrderService.add(tbHouseOrderVo);
    }



    /** @Author 李博帅
     * @Description //TODO 修改
     * @Date 19:45 2023/11/12
     * @param tbHouseOrderVo
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/update")
    @ApiOperation("修改订单")
    public ResultVo updateByVo(@RequestBody TbHouseOrderVo tbHouseOrderVo){
        return tbHouseOrderService.updateByVo(tbHouseOrderVo);
    }



    /** @Author 李博帅
     * @Description //TODO 表联查+订单类型搜索+搜索（手机号/用户名/订单号）
     * @Date 19:45 2023/11/12
     * @param tbHouseOrderSearchVo
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/list")
    @ApiOperation("订单列表")
    public ResultVo getList(@RequestBody TbHouseOrderSearchVo tbHouseOrderSearchVo){
        return tbHouseOrderService.getList(tbHouseOrderSearchVo);
    }



    /** @Author 李博帅
     * @Description //TODO 订单id查询
     * @Date 19:50 2023/11/12
     * @param tbHouseOrderSearchVo
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/getByIdVo")
    @ApiOperation("订单id查询")
    public ResultVo getByVo(@RequestBody TbHouseOrderSearchVo tbHouseOrderSearchVo){
        return tbHouseOrderService.getByVo(tbHouseOrderSearchVo);
    }
}
